import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '签约商户',
    align: "center",
    dataIndex: 'businessId_dictText'
  },
  {
    title: '服务公司',
    align: "center",
    dataIndex: 'companyId_dictText'
  },
  {
    title: '人才信息',
    align: "center",
    dataIndex: 'name',
    width: 240,
    slots: { customRender: 'memberInfoSlot' },
  },
  // {
  //   title: '手机号码',
  //   align: "center",
  //   dataIndex: 'phone'
  // },
  // {
  //   title: '银行卡类型',
  //   align: "center",
  //   dataIndex: 'bankCardType_dictText'
  // },
  {
    title: '银行信息',
    align: "center",
    dataIndex: 'bank',
    width: 240,
    slots: { customRender: 'bankInfoSlot' },
  },
  {
    title: '签约服务类型',
    align: "center",
    dataIndex: 'signingServiceId_dictText',
    customRender:({text}) =>{
      return !text ? "-" : text;
    },
  },
  {
    title: '用户状态',
    align: "center",
    dataIndex: 'status',
    filters: [
      { text: '正常', value: '1' },
      { text: '冻结', value: '2' },
    ],
    filterMultiple: false,
    slots: { customRender: 'userStatusSlot' },
  },
  {
    title: '签约状态',
    align: "center",
    dataIndex: 'signingStatus_dictText',
    slots: { customRender: 'signingStatusSlot' },
  },
  // {
  //   title: '签约备注/拒绝原因',
  //   align: "center",
  //   dataIndex: 'signingRemark',
  //   customRender:({text}) =>{
  //     return !text ? "-" : text;
  //   },
  // },
  {
    title: '创建时间',
    align: "center",
    sorter: true,
    width: 150,
    dataIndex: 'createTime',
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建时间",
    field: "createTime",
    component: 'RangePicker',
    componentProps: {
      showTime: true,
    },
    colProps: {span: 6},
  },
  {
    label: "税源地",
    field: 'companyId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "caishui_middle_company,company_name,company_id"
    },
    colProps: {span: 6},
  },
  {
    label: "商户ID",
    field: 'businessId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "caishui_business,name,id"
    },
    colProps: {span: 6},
  },
  {
    label: "姓名",
    field: 'name',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "手机号码",
    field: 'phone',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "身份证号码",
    field: 'idCard',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "用户状态：1-正常，2-冻结",
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "user_status"
    },
    colProps: {span: 6},
  },
  {
    label: "签约状态：0-待签约，1-签约中，2-已签约，3-失败，4-拒签",
    field: 'signingStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "caishui_member_signing_status"
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '税源地ID',
    field: 'companyId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "caishui_middle_company,company_name,company_id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入税源地ID!'},
             ];
    },
  },
  {
    label: '商户ID',
    field: 'businessId',
    component: 'JSearchSelect',
    componentProps:{
      dict: "caishui_business,name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入商户ID!'},
             ];
    },
  },
  {
    label: '签约服务类型ID（多个英文逗号隔开）',
    field: 'signingServiceId',
    component: 'JSelectMultiple',
    componentProps:{
      dictCode: "caishui_signing_service,name,id"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入签约服务类型ID（多个英文逗号隔开）!'},
             ];
    },
  },
  {
    label: '编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '姓名',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入姓名!'},
             ];
    },
  },
  {
    label: '手机号码',
    field: 'phone',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入手机号码!'},
             ];
    },
  },
  {
    label: '性别',
    field: 'sex',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "sex"
    },
  },
  {
    label: '生日',
    field: 'birthday',
    component: 'DatePicker',
  },
  {
    label: '民族',
    field: 'nation',
    component: 'Input',
  },
  {
    label: '证件类型：1-身份证，2-港澳台通行证，3-护照，4-军官证',
    field: 'idCardType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "id_card_type"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入证件类型：1-身份证，2-港澳台通行证，3-护照，4-军官证!'},
             ];
    },
  },
  {
    label: '身份证号码',
    field: 'idCard',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入身份证号码!'},
             ];
    },
  },
  {
    label: '身份证正面照',
    field: 'idCardZm',
    component: 'JImageUpload',
    componentProps:{
    },
  },
  {
    label: '身份证反面照',
    field: 'idCardFm',
    component: 'JImageUpload',
    componentProps:{
    },
  },
  {
    label: '证件地址',
    field: 'idCardAddress',
    component: 'InputTextArea',
  },
  {
    label: '发证机关',
    field: 'idCardOffice',
    component: 'Input',
  },
  {
    label: '证件有效期止',
    field: 'idCardValid',
    component: 'Input',
  },
  {
    label: '银行卡类型：OTHERBANK-银行卡，ALIPAY-支付宝，WECHAT-微信',
    field: 'bankCardType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "bank_card_type"
    },
  },
  {
    label: '银行卡账号',
    field: 'bankCardAccount',
    component: 'Input',
  },
  {
    label: '支付宝ID',
    field: 'bankZfbId',
    component: 'Input',
  },
  {
    label: '微信ID',
    field: 'bankWxId',
    component: 'Input',
  },
  {
    label: '签约类型：1-e签宝，2-批量导入',
    field: 'signingType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "caishui_member_signing_type"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入签约类型：1-e签宝，2-批量导入!'},
             ];
    },
  },
  {
    label: '签约文件地址',
    field: 'signingFile',
    component: 'JUpload',
    componentProps:{
     },
  },
  {
    label: '用户状态：1-正常，2-冻结',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "user_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入用户状态：1-正常，2-冻结!'},
             ];
    },
  },
  {
    label: '签约状态：0-待签约，1-签约中，2-已签约，3-失败，4-拒签',
    field: 'signingStatus',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "caishui_member_signing_status"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入签约状态：0-待签约，1-签约中，2-已签约，3-失败，4-拒签!'},
             ];
    },
  },
  {
    label: '签约备注/拒绝原因',
    field: 'signingRemark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
